USE [JaxDug]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT [name] FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.InsertUser') AND TYPE IN (N'P', N'PC'))
BEGIN
	DROP PROC InsertUser
	PRINT 'DROP PROC InsertUser'
END
GO

-- ===============================================================
-- Author:		RbH
-- Create date: 2012.03.22
-- Description:	Inserts a new User into the database
-- Ussage:		EXEC InsertUser 'Mr.', 'John', 'Doe', ''
-- ===============================================================
CREATE PROCEDURE dbo.InsertUser
	@Salutation NVARCHAR(4),
	@FirstName NVARCHAR(50),
	@LastName NVARCHAR(50),
	@Bio NVARCHAR(MAX)
AS
BEGIN
	SET NOCOUNT ON;
	
	INSERT INTO dbo.Users ( Salutation, FirstName, LastName, Bio )
	VALUES  ( @Salutation, @FirstName, @LastName, @Bio )
END
GO

PRINT 'CREATE PROC InsertUser'

GRANT EXEC ON InsertUser TO PublicDbUser
GO

PRINT 'GRANT EXEC ON InsertUser TO PublicDbUser'